// css reset
import Vant from 'vant';
import 'vant/lib/index.css';
import 'normalize.css';
import Vue from 'vue';
import Router from 'vue-router';
import root from './root';
import {router} from "./router";
import appHeader from './public/app-header';
import shoppingFooter from './public/shopping-footer';
import commodityFooter from './public/commodity-footer';
import commodityHeader from './public/commodity-header';
import '../static/font-awesome-4.7.0/css/font-awesome.min.css';
import {Eldialog} from "./public/dialog";
import selectArea from './components/select-area';
import request from './request';
import betterScroll from './public/better-scroll';
import axios from 'axios';
import pageRecommend from './public/page-recommend';
// import {Swipe, SwipeItem, Lazyload, Toast, Notify, Badge, BadgeGroup} from 'vant';

Vue.prototype.$http = axios;
// Vue.use(Swipe);
// Vue.use(SwipeItem);
// Vue.use(Lazyload);
// Vue.use(Toast);
// Vue.use(Notify);
// Vue.use(Badge);
// Vue.use(BadgeGroup);

Vue.use(pageRecommend);
Vue.use(commodityHeader);
Vue.use(commodityFooter);
Vue.use(Vant);
Vue.use(appHeader);
Vue.use(shoppingFooter);
Vue.use(selectArea);
Vue.use(Eldialog);
Vue.use(Router);
Vue.use(request);
Vue.use(betterScroll);

new Vue({
  render: h=>h(root),
  router
}).$mount('#app');

router.beforeEach((to, from, next) => {
  // chrome
  document.body.scrollTop = 0;
  // firefox
  document.documentElement.scrollTop = 0;
  // safari
  window.pageYOffset = 0;
  next();
});

